export { store } from "@/store";
export { routerArrays } from "@/layout/types";
export { router, resetRouter, constantMenus } from "@/router";
export { getConfig, responsiveStorageNameSpace } from "@/config";
export {
  ascending,
  filterTree,
  filterNoPermissionTree,
  formatFlatteningRoutes
} from "@/router/utils";
export {
  isUrl,
  isEqual,
  isNumber,
  debounce,
  isBoolean,
  getKeyList,
  storageLocal,
  deviceDetection
} from "@pureadmin/utils";
export type {
  setType,
  appType,
  userType,
  multiType,
  cacheType,
  positionType,
  messageType
} from "./types";

import { genRandomPassword } from "@/utils/truncate";
import { storageLocal } from "@pureadmin/utils";

/**
 * 读取设备编码，当没有编码时会自动生成
 * 目前该逻辑比较简单，可自行修改替换
 *
 * @return string
 */
export const readDeviceId = (): string => {
  let id = storageLocal().getItem<string>("device");
  if (!id) {
    id = genRandomPassword({
      length: 32,
      includeNumbers: true,
      includeLowercase: true,
      includeUppercase: true,
      includeSymbols: false
    });
    storageLocal().setItem("device", id);
  }
  return id;
};
